home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / g_man / cat3 / standard / texgen.z / texgen
Encoding:
Text File  |  1998-10-20  |  11.1 KB  |  257 lines

  1.  
  2.  
  3.  
  4. tttteeeexxxxggggeeeennnn((((3333GGGG))))                                                          tttteeeexxxxggggeeeennnn((((3333GGGG))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      tttteeeexxxxggggeeeennnn - specify automatic generation of texture coordinates
  10.  
  11. CCCC SSSSPPPPEEEECCCCIIIIFFFFIIIICCCCAAAATTTTIIIIOOOONNNN
  12.      vvvvooooiiiidddd tttteeeexxxxggggeeeennnn((((lllloooonnnngggg ccccoooooooorrrrdddd,,,, lllloooonnnngggg mmmmooooddddeeee,,,, ffffllllooooaaaatttt ppppaaaarrrraaaammmmssss[[[[]]]]))))
  13.  
  14. PPPPAAAARRRRAAAAMMMMEEEETTTTEEEERRRRSSSS
  15.      _c_o_o_r_d    Expects the name of the texture coordinate whose generation is
  16.               to be defined, enabled, or disabled.  One of:
  17.  
  18.               TTTTXXXX____SSSS:  The _s texture coordinate
  19.  
  20.               TTTTXXXX____TTTT:  The _t texture coordinate
  21.  
  22.               TTTTXXXX____RRRR:  The _r texture coordinate
  23.  
  24.               TTTTXXXX____QQQQ:  The _q texture coordinate
  25.  
  26.      _m_o_d_e     Expects the mode of generation to be specified, or an indication
  27.               that generation is to be either enabled or disabled.  One of the
  28.               symbolic constants:
  29.  
  30.               TTTTGGGG____CCCCOOOONNNNTTTTOOOOUUUURRRR:  Use the plane equation specified in _p_a_r_a_m_s to
  31.               define a plane in eye-coordinates.  Generate a texture
  32.               coordinate that is proportional to vertex distance from this
  33.               plane.
  34.  
  35.               TTTTGGGG____LLLLIIIINNNNEEEEAAAARRRR:  Use the plane equation specified in params to define
  36.               a plane in object-coordinates.  Generate a texture coordinate
  37.               that is proportional to vertex distance from this plane.
  38.  
  39.               TTTTGGGG____SSSSPPPPHHHHEEEERRRREEEEMMMMAAAAPPPP:  Generate texture coordinates based on the vertex
  40.               and current normal.  When used with the appropriate texture
  41.               (described below), this gives the appearance of the reflection
  42.               of an environment placed at infinity.  Typically, both TTTTXXXX____SSSS and
  43.               TTTTXXXX____TTTT are enabled.
  44.  
  45.               TTTTGGGG____OOOONNNN:  Enable the (previously defined) replacement for the
  46.               specified texture coordinate.
  47.  
  48.               TTTTGGGG____OOOOFFFFFFFF:  Disable replacement of the specified texture coordinate
  49.               (the default).
  50.  
  51.      _p_a_r_a_m_s   Expects a 4-component plane equation when _m_o_d_e is TTTTGGGG____CCCCOOOONNNNTTTTOOOOUUUURRRR or
  52.               TTTTGGGG____LLLLIIIINNNNEEEEAAAARRRR.  Array element 0 is plane equation component A, 1 is
  53.               B, 2 is C, and 3 is D.  The specified contents of _p_a_r_a_m_s are
  54.               insignificant when _m_o_d_e is TTTTGGGG____OOOONNNN, TTTTGGGG____OOOOFFFFFFFF, or TTTTGGGG____SSSSPPPPHHHHEEEERRRREEEEMMMMAAAAPPPP.
  55.  
  56. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  57.      Texture coordinates _s, _t, _r, and _q can be specified directly using the tttt
  58.      command.  It is also possible to have texture coordinates generated
  59.      automatically as a function of object geometry.  tttteeeexxxxggggeeeennnn specifies,
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. tttteeeexxxxggggeeeennnn((((3333GGGG))))                                                          tttteeeexxxxggggeeeennnn((((3333GGGG))))
  71.  
  72.  
  73.  
  74.      enables, and disables such automatic generation.  Either or both texture
  75.      coordinates can be generated independently.  Automatic texture coordinate
  76.      generation is disabled by default.
  77.  
  78.      tttteeeexxxxggggeeeennnn supports three generation algorithms:  TTTTGGGG____LLLLIIIINNNNEEEEAAAARRRR, TTTTGGGG____CCCCOOOONNNNTTTTOOOOUUUURRRR, and
  79.      TTTTGGGG____SSSSPPPPHHHHEEEERRRREEEEMMMMAAAAPPPP.  TTTTGGGG____LLLLIIIINNNNEEEEAAAARRRR operates directly on object coordinates, and is
  80.      therefore most useful for textures that are locked to objects, such as
  81.      ground texture locked to a terain, or metalic texture locked to a
  82.      cylinder.  TTTTGGGG____CCCCOOOONNNNTTTTOOOOUUUURRRR operates on eye-coordinates.  It supports motion of
  83.      an object through a `field' of texture coordinates.  TTTTGGGG____SSSSPPPPHHHHEEEERRRREEEEMMMMAAAAPPPP
  84.      computes a reflection based on the vertex and normal in eye-coordinates.
  85.  
  86.      Both modes TTTTGGGG____LLLLIIIINNNNEEEEAAAARRRR and TTTTGGGG____CCCCOOOONNNNTTTTOOOOUUUURRRR define a texture coordinate
  87.      generation function that is a linear function of distance from a plane.
  88.      The plane equation is specified as a single, 4-component, vector in
  89.      object coordinates.
  90.  
  91.  
  92.           Pobject = |||| dcba ||||
  93.      The TTTTGGGG____LLLLIIIINNNNEEEEAAAARRRR plane equation remains in object-coordinates.  The
  94.      TTTTGGGG____CCCCOOOONNNNTTTTOOOOUUUURRRR plane equation is transformed by the ModelView matrix into
  95.      eye-coordinates when it is defined:
  96.  
  97.           Peye = MModelView-1       Pobject
  98.      When a generation function has been defined for a texture coordinate, and
  99.      tttteeeexxxxggggeeeennnn has been called with TTTTGGGG____OOOONNNN, each vertex presented to the graphics
  100.      system has that texture coordinate value replaced with the distance of
  101.      the vertex from the defined plane.  For example, when texture coordinate
  102.      _s is generated by a TTTTGGGG____LLLLIIIINNNNEEEEAAAARRRR function, the generation function is:
  103.  
  104.  
  105.           s = Vobject.Pobject = || xobject, yobject, zobject, wobject||.|||| dcba ||||
  106.      Alternately, when _t is generated by a TTTTGGGG____CCCCOOOONNNNTTTTOOOOUUUURRRR function, the generation
  107.      function is:
  108.  
  109.           t = Veye.Peye
  110.      where
  111.  
  112.           Veye = Vobject MModelView,
  113.      and
  114.  
  115.           Peye = MModelView-1       Pobject
  116.  
  117.  
  118.  
  119.  
  120.                                                                         PPPPaaaaggggeeee 2222
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127. tttteeeexxxxggggeeeennnn((((3333GGGG))))                                                          tttteeeexxxxggggeeeennnn((((3333GGGG))))
  128.  
  129.  
  130.  
  131.      Note that the ModelView matrix that modifies the plane equation is the
  132.      ModelView matrix in effect when tttteeeexxxxggggeeeennnn was called, while the ModelView
  133.      matrix that modifies the vertex coordinates is the matrix used to
  134.      transform that vertex.
  135.  
  136.      The creation of an appropriate texture for TTTTGGGG____SSSSPPPPHHHHEEEERRRREEEEMMMMAAAAPPPP requires some
  137.      explanation.  Consider a unit sphere centered at the viewpoint which
  138.      represents the complete environment.  The mapping of this sphere to a 2D
  139.      texture is captured with a formula, given below.
  140.  
  141.      Let _R be an arbitrary unit vector based at the viewpoint.  _s and _t are
  142.      texture coordinates in the range 0.0 to 1.0.  The texture value is taken
  143.      from the point of intersection between _R and the unit sphere.  The set of
  144.      all possible values of _R captures the complete environment.  The mapping
  145.      from _R to texture coordinates _s and _t is:
  146.  
  147.                mag = 2*sqrt(R.x*R.x+R.y*R.y+(R.z+1)*(R.z+1))
  148.  
  149.                s = R.x/mag+.5
  150.  
  151.                t = R.y/mag+.5
  152.  
  153.      The point in the environment directly behind the viewer maps to _s = .5, _t
  154.      = .5.  The intersection between the plane _z = 0 and the environment maps
  155.      to a circle centered at _s = .5, _t = .5 with a radius of sqrt(2)/4.  The
  156.      point in the environment directly in front of the viewer maps to a circle
  157.      with a radius of .5.  This circle marks the boundary of the complete
  158.      environment in the texture.  In a reflection, this boundary can be
  159.      approached but not reached.  Since the view direction is fixed for each
  160.      environment texture, a change in the view direction will require a new
  161.      texture to be calculated.
  162.  
  163.      tttteeeexxxxggggeeeennnn generation functions remain valid until they are redefined.  They
  164.      are enabled and disabled without redefinition by calls to tttteeeexxxxggggeeeennnn with
  165.      modes TTTTGGGG____OOOONNNN and TTTTGGGG____OOOOFFFFFFFF.  tttteeeexxxxggggeeeennnn definition has no effect on the enable
  166.      mode of the texture generation function.
  167.  
  168.      When enabled, tttteeeexxxxggggeeeennnn replaces _s, _t, or both each time a vertex command is
  169.      received.  A texture coordinate that is not being generated continues to
  170.      be specified by tttt commands.  Texture coordinate are transformed by the
  171.      Texture matrix (see mmmmmmmmooooddddeeee) following coordinate replacement by tttteeeexxxxggggeeeennnn.
  172.  
  173. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  174.      mmode, n, t, texdef2d, texdef3d, texbind, tevdef, tevbind, v
  175.  
  176. NNNNOOOOTTTTEEEESSSS
  177.      IRIS-4D G, GT, and GTX models, and the Personal Iris, do not support
  178.      texture mapping.  tttteeeexxxxggggeeeennnn is ignored by these machines.  The Iris Indy,
  179.      Indigo Entry, and XL support texture mapping except for lines.  IRIS-4D
  180.      VGX and VGXT models, the Personal Iris, Indy, Indigo Entry, XS, XS24, XZ,
  181.      Elan and Extreme systems do not support TTTTXXXX____RRRR and TTTTXXXX____QQQQ.  Use ggggeeeettttggggddddeeeesssscccc to
  182.      determine whether texture mapping is supported.
  183.  
  184.  
  185.  
  186.                                                                         PPPPaaaaggggeeee 3333
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193. tttteeeexxxxggggeeeennnn((((3333GGGG))))                                                          tttteeeexxxxggggeeeennnn((((3333GGGG))))
  194.  
  195.  
  196.  
  197.      tttteeeexxxxggggeeeennnn cannot be used while mmmmmmmmooooddddeeee is MMMMSSSSIIIINNNNGGGGLLLLEEEE.
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.                                                                         PPPPaaaaggggeeee 4444
  253.  
  254.  
  255.  
  256.